// 创建路由器
const express = require("express");
//引入连接池
const pool = require("../../pool");
//定义路由器
const router = express.Router();
//抛出路由器
module.exports = router;

router.get("/", (req, res) => {
  res.send({ info: "我是用户订单页面", code: 200 });
});

// 请求桌台数据
router.get("/table", (req, res) => {
  pool.query("SELECT * FROM xfn_table WHERE status=0 ", (err, result) => {
    if (err) throw err;
    res.send(result);
  });
});

// 修改菜单数据
router.get("/table", (req, res) => {
  pool.query("UPDATE xfn_dish SET num=0 WHERE num!=0", (err, result) => {
    if (err) throw err;
    res.send(result);
  });
});
